import 'package:fluent_ui/fluent_ui.dart';
import 'package:fnos_tv_desktop/view/main/common/title_bar_actions.dart';
import 'package:fnos_tv_desktop/view/main/home/play_list_row.dart';
import 'package:provider/provider.dart';

import '../../../core/model/media_databases.dart';
import 'media_db_list_row.dart';
import 'media_db_row.dart';

class HomeView extends StatefulWidget {
  const HomeView({super.key});

  @override
  State<HomeView> createState() => _HomeViewState();
}

class _HomeViewState extends State<HomeView> {
  @override
  Widget build(BuildContext context) {
    final dbs = context.watch<MediaDatabases>();
    return ScaffoldPage.scrollable(
      header: PageHeader(
        title: Text('首页'),
        commandBar: TitleBarActions(),
      ),
      children: [
        MediaDbListRow(),
        PlayListRow(),
        ...?dbs.databases?.map((e) => MediaDbRow(db: e)),
      ],
    );
  }
}
